package com.sskj.b70.m.bean;

import com.google.gson.annotations.JsonAdapter;
import com.sskj.b70.box.gson.StringKeep4Adapter;
import com.sskj.b70.utils.NumberUtil;

import java.math.BigDecimal;

/**
 * 作者 :吕志豪
 * 简书：https://www.jianshu.com/u/6e525b929aac
 * github：https://github.com/lvzhihao100
 * 描述：
 * 创建时间：2018-10-11 17:24
 */
public class DagBean {

    /**
     * account : string
     * allocationCoinFundAll : 0
     * clearTime : 2018-10-11T09:23:21.360Z
     * coinFundAll : 0
     * id : 0
     * isRelease : false
     * releaseTime : 2018-10-11T09:23:21.360Z
     * stockCode : string
     * stockUserFund : 0
     * stockUserId : 0
     * timestamp : 2018-10-11T09:23:21.360Z
     * username : string
     */

    private String account;
    @JsonAdapter(value = StringKeep4Adapter.class)
    private String allocationCoinFundAll;
    private String allocationCoinFeeAll;
    private String clearTime;
    private String coinFundAll;
    private int id;
    private boolean isRelease;
    private String releaseTime;
    private String stockCode;
    private String stockUserFund;
    private int stockUserId;
    private String timestamp;
    private String username;

    public String getAllocationCoinFeeAll() {
        return allocationCoinFeeAll;
    }

    public void setAllocationCoinFeeAll(String allocationCoinFeeAll) {
        this.allocationCoinFeeAll = allocationCoinFeeAll;
    }

    public String getAccount() {
        return account;
    }

    public void setAccount(String account) {
        this.account = account;
    }

    public String getAllocationCoinFundAll() {
        return allocationCoinFundAll;
    }

    public void setAllocationCoinFundAll(String allocationCoinFundAll) {
        this.allocationCoinFundAll = allocationCoinFundAll;
    }

    public String getClearTime() {
        return clearTime;
    }

    public void setClearTime(String clearTime) {
        this.clearTime = clearTime;
    }

    public String getCoinFundAll() {
        return coinFundAll;
    }

    public void setCoinFundAll(String coinFundAll) {
        this.coinFundAll = coinFundAll;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public boolean isRelease() {
        return isRelease;
    }

    public void setRelease(boolean release) {
        isRelease = release;
    }

    public String getReleaseTime() {
        return releaseTime;
    }

    public void setReleaseTime(String releaseTime) {
        this.releaseTime = releaseTime;
    }

    public String getStockCode() {
        return stockCode;
    }

    public void setStockCode(String stockCode) {
        this.stockCode = stockCode;
    }

    public String getStockUserFund() {
        return NumberUtil.keepNoZeroMax8(stockUserFund);
    }

    public void setStockUserFund(String stockUserFund) {
        this.stockUserFund = stockUserFund;
    }

    public int getStockUserId() {
        return stockUserId;
    }

    public void setStockUserId(int stockUserId) {
        this.stockUserId = stockUserId;
    }

    public String getTimestamp() {
        return timestamp;
    }

    public void setTimestamp(String timestamp) {
        this.timestamp = timestamp;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getShareNum() {
        if (new BigDecimal(coinFundAll).doubleValue() == 0) {
            return "0";
        } else {
            return NumberUtil.keepNoZeroMax8(new BigDecimal(allocationCoinFundAll == null ? allocationCoinFeeAll : allocationCoinFundAll).multiply(new BigDecimal(stockUserFund)).divide(new BigDecimal(coinFundAll), 8, BigDecimal.ROUND_HALF_UP).toPlainString());
        }
    }
}
